import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import path from "path";

export default defineConfig({
  plugins: [vue(),vueJsx()],
  //使用@指向src
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
    },
  },
  // 配置开发服务器和代理
  server: {
    proxy: {
      // 代理所有以/cy开头的请求
      "/cy": {
        target: "http://localhost:8088", // 后端地址
        changeOrigin: true, // 需要虚拟托管站点
        rewrite: (path) => path.replace(/^\/cy/, ""), // 重写路径，去掉/cy
      }
    },
  },
});
